Check for Default trait implementation in initial condition when linting [manual_unwrap_or_default]#12566
Closed
ARandomDev99 wants to merge 22 commits intorust-lang:masterfrom
Closed
Conversation
Collaborator
|
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
Default trait implementation in initial conditionDefault trait implementation in initial condition when linting [manual_unwrap_or_default]
Contributor
Author
|
r? @Jarcho |
Contributor
|
☔ The latest upstream changes (presumably #12579) made this pull request unmergeable. Please resolve the merge conflicts. |
I want to be clear: this is just the initial draft outlining what, I think, should be the responsibilities of the team members. It has not yet been discussed with anyone else.
Instead of just saying “this function's stack frame is big”, report: * the (presumed) size of the frame * the size and type of the largest local contributing to that size * the configurable limit that was exceeded (once)
Signed-off-by: shandongbinzhou <[email protected]>
This extends the `filter_map_identity` lint to support typed closures. For untyped closures, we know that the program compiles, and therefore we can safely suggest using flatten. For typed closures, they may participate in type resolution. In this case we use `Applicability::MaybeIncorrect`. Details: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Should.20.60filter_map_identity.60.20lint.20when.20closures.20are.20typed.3F
`Box::default()` had its `#[rustc_box]` attribute removed in 1.69 so is no longer a perf related lint The lint is moved to style but no longer produces suggestions containing turbofishes, as they're often longer/more annoying to type
Contributor
|
☔ The latest upstream changes (presumably #12453) made this pull request unmergeable. Please resolve the merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12564
changelog: Fix [
manual_unwrap_or_default] false positive when initialmatch/if letcondition doesn't implementDefaultbut the return type does.